package com.example.myshortcutdemo

import android.app.ActivityManager
import android.graphics.BitmapFactory
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.databinding.DataBindingUtil
import com.example.myshortcutdemo.databinding.ActivityCustomShortcutMainBinding
import com.example.myshortcutdemo.databinding.ActivityMainBinding
import com.example.myshortcutdemo.databinding.ActivityShortcutMainBinding

class CustomShortCutActivity : AppCompatActivity() {
    private lateinit var mBind :ActivityCustomShortcutMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mBind =  DataBindingUtil.setContentView(
            this,
            R.layout.activity_custom_shortcut_main
        )

        Log.d("自定义的", "onCreate: CustomShortCutActivity")

        //设置栈描述
        setCustomTaskDescription()
    }

    /**
     *taskAffinity 参数配置的 所谓TaskDescription就是给当前的任务设置一个描述，
     * 描述中可以包含任务的名称和图标。
     *
     **/
    private fun setCustomTaskDescription() {
        val taskDescription = ActivityManager.TaskDescription(
            "FirstActivity",
            BitmapFactory.decodeResource(resources,R.drawable.ic_device_mode_welcome)
        )
        setTaskDescription(taskDescription)
    }
}